package com.zx.framework.plat.dept;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.zx.framework.plat.dept.po.Dept;

public class DeptUtil {
	/**
	 * 获取layer的层级path
	 * @param layer
	 * @param length
	 * @return
	 */
	public static String getNodePath(String layer,int length){
		StringBuilder sb= new StringBuilder();
		for (int i = 0; i < layer.length(); i=i+length) {
			sb.append("/"+layer.substring(0,i+length));
		}
		return sb.toString();
		
	}
	/**
	 * 获取有限制的层级path
	 * @param layer
	 * @param limit
	 * @param length
	 * @return
	 */
	public static String getNodePath(String layer,int limit,int length){
		StringBuilder sb= new StringBuilder();
		for (int i = limit; i < layer.length(); i=i+length) {
			sb.append("/"+layer.substring(0,i+length));
		}
		return sb.toString();
		
	}
	/**
	 * 获取每个子级的nodepath
	 * @param depts 子级部门
	 * @param userDept 用户当前部门
	 * @return
	 */
	public static String getNodePath(List<Dept> depts,Dept userDept){
		Map<String, Dept> deptMap = new HashMap<String, Dept>();
		for (Dept dept : depts) {
			deptMap.put(dept.getId(), dept);
		}
		return "";
	}
	
	public static void main(String[] args) {
		String layer = "001002001";
		System.out.println(getNodePath(layer,3,3));
	}
}
